package Server;

/*
 * Author: Anthony Fleshner
 * 
 * Window.java: used to create the window and layout its components
 */

import java.awt.Dimension;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Window{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	JFrame mainFrame;
	JPanel mainPanel;
//	JPanel controlPanel;
	
	RobotMouseListener mouseListener;
	
	public Window(ControlComponent control){
		
		mouseListener = new RobotMouseListener(control);
		
		mainFrame = new JFrame("Paint Bot");
		mainFrame.setSize(800, 600);
		mainFrame.setPreferredSize(new Dimension(800,600));
		mainFrame.setLocationRelativeTo(null);
		mainFrame.setLayout(new FlowLayout(FlowLayout.LEFT));
	
		mainPanel = new JPanel();
		mainPanel.setSize(800, 600);
		mainPanel.setPreferredSize(new Dimension(800,600));
		mainPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
		mainPanel.add(control.getRobot());
		mainPanel.add(control);
		mainPanel.addMouseMotionListener(mouseListener);
		mainPanel.setVisible(true);
		
		mainFrame.getContentPane().add(mainPanel);
        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		mainFrame.setVisible(true);
	
		mainPanel.repaint();
		mainFrame.repaint();
	
	}


	
}
